/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package mumaker.spots;

import java.util.ArrayList;

/**
 *
 * @author Javs
 */
public class GestSpots {

    private static GestSpots INSTANCE = null;
    private ArrayList<Spots> arrSpots = new ArrayList<Spots>();

    private synchronized static void createInstance() {
        if (INSTANCE == null) {
            INSTANCE = new GestSpots();
        }
    }

    public static GestSpots getInstance() {
        createInstance();
        return INSTANCE;
    }
   //Mob	Map	Radio	CordX	CordY	CordX2	CordY2	Dir 	Quant  Name

    public void agregarPunto(int mob, int mapa, int radio, int x, int y, int x2, int y2, int dire, int cant) {
        Mob objMob = GestMob.getInstance().retornarMob(mob);
        
        Spots s = new Spots(objMob, mapa, radio, x, y, x2, y2, dire, cant);
        arrSpots.add(s);
    }

    public ArrayList<Spots> devolverSpots() {
        return this.arrSpots;
    }

    public ArrayList<Spots> devolverSpotsMapa(int Mapa) {
        ArrayList<Spots> arrSpotsDelMapa = new ArrayList<Spots>();
        for (Spots objS : this.arrSpots) {
            if (objS.getMapa() == Mapa) {
                arrSpotsDelMapa.add(objS);
            }
        }
        return arrSpotsDelMapa;

    }

    public int sumarCantMobs() {
        int total = 0;
        for (Spots objS : this.arrSpots) {
            total += objS.getCantidad();
        }

        return total;
    }
}
